<template>
    <div class="AnchorInfo">
        <!-- <rui-form :form-options="formOptions" :label-width="120" :read-only="false" ref="formData"></rui-form> -->
        <Form :label-width="120" ref="formData" :model="formData" disabled>
            <Row v-if="showItem === 1">
                <Col span="12">
                    <FormItem label="公司名称:" class="item-disabled">
                        <div>{{formData.affiliatedName}}</div>
                    </FormItem>
                </Col>
                <Col span="12">
                    <FormItem label="统一社会信用代码:" class="item-disabled">
                        <div>{{formData.socUniCrtCode}}</div>
                    </FormItem>
                </Col>
                <Col span="12">
                    <FormItem label="法人姓名:" class="item-disabled">
                        <div>{{formData.legalName}}</div>
                    </FormItem>
                </Col>
                <Col span="12">
                    <FormItem label="联系方式:" prop="phone" class="item-disabled">
                        <div>{{formData.legalPhone}}</div>
                    </FormItem>
                </Col>
                <Col span="12">
                    <FormItem label="挂靠方式:" prop="affiliatedType" class="item-disabled">
                        <div>{{formData.affiliatedType}}</div>
                    </FormItem>
                </Col>
            </Row>
            <Row v-if="showItem === 2">
                <Col span="12">
                    <FormItem label="运营公司:" class="item-disabled" >
                        <div>{{formData.affiliatedName}}</div>
                    </FormItem>
                </Col>
                <Col span="12">
                    <FormItem label="统一社会信用代码:" class="item-disabled">
                        <div>{{formData.socUniCrtCode}}</div>
                    </FormItem>
                </Col>
                <Col span="12">
                    <FormItem label="网约车平台:" class="item-disabled" >
                        <div>{{getTitle('netCarCooperPlat',formData.cooperPlatform)}}</div>
                    </FormItem>
                </Col>
                <Col span="12">
                    <FormItem label="挂靠方式:" prop="affiliatedType" class="item-disabled">
                        <div>{{formData.affiliatedType}}</div>
                    </FormItem>
                </Col>
            </Row>
            <Row v-if="showItem === 3">
                <Col span="12">
                    <FormItem label="个体工商户名称:" class="item-disabled">
                        <div>{{formData.affiliatedName}}</div>
                    </FormItem>
                </Col>
                <Col span="12">
                    <FormItem label="统一社会信用代码:" class="item-disabled">
                        <div>{{formData.socUniCrtCode}}</div>
                    </FormItem>
                </Col>
                <Col span="12">
                    <FormItem label="挂靠方式:" prop="affiliatedType" class="item-disabled">
                        <div>{{formData.affiliatedType}}</div>
                    </FormItem>
                </Col>
            </Row>
        </Form>
    </div>
</template>

<script>
    import { getTitleFromDataDict } from "_p/basic/assets/contract/js/utils";
export default {
    props: {
        contractNo: {
            type: String,
            required:true
        },
        dataDict: {
            type: Object,
            required: true
        }
    },
    data() {
        return {
            defines: [],
            baseData: {},
            formData: {},
            showItem: 0,
            formOptions: []
            // companyOptions: [
            //     {
            //         isGroup: false,
            //         grids: [
            //             {
            //                 defineId: "defineData",
            //                 span: 8,
            //                 fields: ["affiliatedName", "legalPhone"]
            //             },
            //             {
            //                 defineId: "defineData",
            //                 span: 8,
            //                 fields: ["socUniCrtCode"]
            //             },
            //             {
            //                 defineId: "defineData",
            //                 span: 8,
            //                 fields: ["legalName"]
            //             }
            //         ]
            //     }
            // ],
            // personalOptions: [
            //     {
            //         isGroup: false,
            //         grids: [
            //             {
            //                 defineId: "defineData",
            //                 span: 8,
            //                 fields: ["cooperPlatform"]
            //             },
            //             {
            //                 defineId: "defineData",
            //                 span: 8,
            //                 fields: ["socUniCrtCode"]
            //             },
            //             {
            //                 defineId: "defineData",
            //                 span: 8,
            //                 fields: ["platformId"]
            //             }
            //         ]
            //     }
            // ],
            // newworkOptions: [
            //     {
            //         isGroup: false,
            //         grids: [
            //             {
            //                 defineId: "defineData",
            //                 span: 8,
            //                 fields: ["legalName"]
            //             },
            //             {
            //                 defineId: "defineData",
            //                 span: 8,
            //                 fields: ["socUniCrtCode"]
            //             }
            //         ]
            //     }
            // ]
        };
    },
    mounted() {},
    methods: {
        getTitle(type, val) {
            let data = this.dataDict[type + "Dict"] || [];
            return getTitleFromDataDict(data, val);
        },
        updateData(data) {
            console.log("挂靠信息===updateData", data);
            // if (Array.isArray(data)) this.baseData = data;
            // COMPANY_AFFILIATED：  公司挂靠
            // PERSONAL_AFFILIATED：个人挂靠
            // NETWORK_CAR_AFFILIATED：网约车挂靠
            this.formData = data;



            switch (data.affiliatedType) {
                case "COMPANY_AFFILIATED":
                    this.showItem = 1;
                    this.formData.affiliatedType = "第三方公司挂靠";
                    // this.formOptions = companyOptions;
                    break;
                case "PERSONAL_AFFILIATED":
                    this.showItem = 3;
                    this.formData.affiliatedType  = "个体工商挂靠";
                    // this.formOptions = personalOptions;
                    break;
                case "NETWORK_CAR_AFFILIATED":
                    this.showItem = 2;
                    this.formData.affiliatedType = "网约车挂靠";
                    // this.formOptions = newworkOptions;
                    break;
                default:
                    this.showItem = 0;
            }

            // this.$refs.formData.updateFormData(data);
        }
    },

};
</script>
